package com.mywang.weitravel.util;

/**
 * @Description:日志信息Log
 */
public class LogUtil {

    public static int RETURN_DISABLE_LOG = -10; // Log被disable,将不输出信息

    private static boolean USE_LOG = true;

    private LogUtil() {

    }

    /**
     * @param tag Used to identify the source of a log message. It usually
     *            identifies the class or activity where the log call occurs.
     * @param msg The message you would like logged.
     */
    public static int v(String tag, String msg) {
        if (USE_LOG) {
            return android.util.Log.v(tag, msg);
        } else {
            return RETURN_DISABLE_LOG;
        }
    }

    /**
     * @param tag Used to identify the source of a log message. It usually
     *            identifies the class or activity where the log call occurs.
     * @param msg The message you would like logged.
     * @param tr  An exception to log
     */
    public static int v(String tag, String msg, Throwable tr) {
        if (USE_LOG) {
            return android.util.Log.v(tag, msg, tr);
        } else {
            return RETURN_DISABLE_LOG;
        }
    }

    /**
     * @param tag Used to identify the source of a log message. It usually
     *            identifies the class or activity where the log call occurs.
     * @param msg The message you would like logged.
     */
    public static int d(String tag, String msg) {
        if (USE_LOG) {
            return android.util.Log.d(tag, msg);
        } else {
            return RETURN_DISABLE_LOG;
        }
    }

    public static int d(String msg) {
        if (USE_LOG) {
            return android.util.Log.e("mewuu", msg);
        } else {
            return RETURN_DISABLE_LOG;
        }
    }

    /**
     * @param tag Used to identify the source of a log message. It usually
     *            identifies the class or activity where the log call occurs.
     * @param msg The message you would like logged.
     * @param tr  An exception to log
     */
    public static int d(String tag, String msg, Throwable tr) {
        if (USE_LOG) {
            return android.util.Log.d(tag, msg, tr);
        } else {
            return RETURN_DISABLE_LOG;
        }
    }

    /**
     * @param tag Used to identify the source of a log message. It usually
     *            identifies the class or activity where the log call occurs.
     * @param msg The message you would like logged.
     */
    public static int i(String tag, String msg) {
        if (USE_LOG) {
            return android.util.Log.i(tag, msg);
        } else {
            return RETURN_DISABLE_LOG;
        }
    }

    /**
     * @param tag Used to identify the source of a log message. It usually
     *            identifies the class or activity where the log call occurs.
     * @param msg The message you would like logged.
     * @param tr  An exception to log
     */
    public static int i(String tag, String msg, Throwable tr) {
        if (USE_LOG) {
            return android.util.Log.i(tag, msg, tr);
        } else {
            return RETURN_DISABLE_LOG;
        }
    }

    /**
     * @param tag Used to identify the source of a log message. It usually
     *            identifies the class or activity where the log call occurs.
     * @param msg The message you would like logged.
     */
    public static int w(String tag, String msg) {
        if (USE_LOG) {
            return android.util.Log.w(tag, msg);
        } else {
            return RETURN_DISABLE_LOG;
        }
    }

    /**
     * @param tag Used to identify the source of a log message. It usually
     *            identifies the class or activity where the log call occurs.
     * @param msg The message you would like logged.
     * @param tr  An exception to log
     */
    public static int w(String tag, String msg, Throwable tr) {
        if (USE_LOG) {
            return android.util.Log.w(tag, msg, tr);
        } else {
            return RETURN_DISABLE_LOG;
        }
    }

    /*
     * Send a {@link #WARN} log message and log the exception.
     *
     * @param tag Used to identify the source of a log message. It usually
     * identifies the class or activity where the log call occurs.
     *
     * @param tr An exception to log
     */
    public static int w(String tag, Throwable tr) {
        if (USE_LOG) {
            return android.util.Log.w(tag, tr);
        } else {
            return RETURN_DISABLE_LOG;
        }
    }

    /**
     * @param tag Used to identify the source of a log message. It usually
     *            identifies the class or activity where the log call occurs.
     * @param msg The message you would like logged.
     */
    public static int e(String tag, String msg) {
        if (USE_LOG) {
            return android.util.Log.e(tag, msg);
        } else {
            return RETURN_DISABLE_LOG;
        }
    }

    public static int e(String msg) {
        if (USE_LOG) {
            return android.util.Log.e("dderror", msg);
        } else {
            return RETURN_DISABLE_LOG;
        }
    }

    /**
     * @param tag Used to identify the source of a log message. It usually
     *            identifies the class or activity where the log call occurs.
     * @param msg The message you would like logged.
     * @param tr  An exception to log
     */
    public static int e(String tag, String msg, Throwable tr) {
        if (USE_LOG) {
            return android.util.Log.e(tag, msg, tr);
        } else {
            return RETURN_DISABLE_LOG;
        }
    }
}
